# -*- coding: utf-8 -*-
<%inherit file="../base.mako"/>

<%namespace name="student_comps" file="/students/components.mako"/>
<%namespace name="building_comps" file="/buildings/components.mako"/>

<h2>
Room ${c.room.label|h}
</h2>

<h3>
Building: ${building_comps.link_to(c.room.building)}
</h3>

<h3>
% try:
${"Plugged on switch %s port %s" % (
	c.room.switchport.switch.hostname,
	c.room.switchport.number)|h}
% except:
Not plugged to any switch.
% endtry
</h3>

<h3>
Students:
</h3>
<table>
	<tr>
		<th>From</th>
		<th>To</th>
		<th>Student</th>
	</tr>
%for userassoc in c.room.userassociations:
	<tr>
	    <td>
	    	${userassoc.from_date|h}
		</td>
		<td>
			${userassoc.to_date or u'Now'|h}
		</td>
		<td>
			${student_comps.link_to(userassoc.user)}
		</td>
	</tr>
%endfor
</table>